<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title></title>
	<link rel="stylesheet" href="">
</head>
<body>
<script src="https://cdn.bootcss.com/vue/2.5.8/vue.js"></script>
<div id="root">
	<div>
		<my-component>
			
		</my-component>
	</div>
</div>
<script>
	//不必在全局注册每个组件。通过使用组件实例选项注册，可以使组件仅在另一个实例/组件的作用域中可用：
	var child = {
		template : '<p @click="doClick">这是一个p组件</p>',
		data : function(){
			return {message:'你好啊,李金文'};
		},
		methods : {
			doClick : function(){
				this.$el.innerHTML = this.message;
			}
		},
	}
	new Vue({
		el : "#root",
		data : {

		},
		components : {
			'my-component' : child,
		}
	})
</script>	
</body>
</html>